In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].
If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.
Quite unluckily Byteasar has found himself in the middle of a desert, meters from the closest oasis.
Lucky enough, Byteasar has a compass and he perfectly knows in which direction he should go to reach the oasis. He has milliliters of water with him, but he is able to carry at most milliliters at a time. Walking one meter requires drinking one milliliter of water for Byteasar; for simplicity we assume that Byteasar drinks water at a fixed pace, e.g. after walking meters he has drunk milliliters of water. At each moment of time Byteasar can put aside any amount of water that he can drink later. Sometimes it may pay him off to come back for water that he has left behind.
To prevent further unlucky coincidence, Byteasar would like to bring as much water to the oasis as possible (who knows if there is any water in that oasis, anyway?). How much water is he able to bring?
We assume that Byteasar is able to reach the oasis if he chooses a smart enough water-drinking strategy.
The first line of the standard input contains three integers , and () that represent Byteasar's distance from the oasis, the quantity of water that he has and the maximum quantity of water that he can carry.
Your program should write to the standard output one real number: the maximum volume of water (in milliliters) that Byteasar can bring to the oasis. The number should be written with three digits after the dot. Your solution will be accepted if it differs from the exact result by at most .
For the input data:
10 30 10
the correct result is:
5.333
Task author: Fabrizio Grandoni.